package com.eight.cloud.openfeign.admin.factory;

import com.eight.cloud.openfeign.admin.api.UserClient;
import com.eight.cloud.core.global.model.LoginUser;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @ClassName: UserFallbackFactory
 * @Author: TXC
 * @Date: 2024-10-13 21:36
 **/
@Component
@Slf4j
public class UserFallbackFactory implements FallbackFactory<UserClient> {

    @Override
    public UserClient create(Throwable cause) {
        return new UserClient() {
            @Override
            public LoginUser getUserinfo(String username, String tenantId) {
                throw new RuntimeException("获取用户信息失败");
            }
        };
    }
}
